package com.xzc.algorithm.data_structure_ke.ArrayList.stack;

import com.xzc.algorithm.data_structure_ke.ArrayList.array._1_Array;

public class _0_Stack<E> {
    private _1_Array<E> array;

    public _0_Stack(int capacity) {
        array = new _1_Array<>(capacity);
    }

    public _0_Stack() {
        this(10);
    }

    public void push(E e) {
        array.addLast(e);
    }

    public E pop() {
        return array.removeLast();
    }

    public int seek() {
        return array.getSize() - 1;
    }

    @Override
    public String toString(){
        return array.toString();
    }
}
